#ifndef _WEB_SERVER_H_
#define _WEB_SERVER_H_

#include "web_shttpd.h"
#include "web_pthread.h"

class web_server: public http_event, public web_pthread
{
public:
    web_server(int port);
    ~web_server();
    int init(int argc,char* argv[]);
    int start();
    void stop();
    void release();

public:
    std::string on_message(std::string struri, std::string strmsg);
    int err_message();

private:
    std::string post_get_data(std::string strpostdata);
    std::string post_delete_data(std::string strdata);
    std::string post_add_data(std::string strdata);
    std::string post_login(std::string strdata);

    std::string get_data_by_hid(std::string strhid);
    std::string get_data_by_devid(std::string strdevid);
    std::string get_data_by_type(std::string strtype, int pageno);

private:
    void run();

private:
    int _port;
    web_httpd* _phttpd;
    bool _is_start;
};



#endif /*_WEB_SERVER_H_*/